From ff3d15d13464d16a561a989f77cb56a8034e3410 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Fri, 6 Feb 2009 00:02:44 +0000 Subject: [PATCH] (bug 15283) Interwiki imports should fetch included templates --- RELEASE-NOTES | 1 + includes/Import.php | 6 ++++-- includes/specials/SpecialImport.php | 11 ++++++++++- languages/messages/MessagesEn.php | 1 + maintenance/language/messages.inc | 1 + 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 7574a82c45..bbea0541d5 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -82,6 +82,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 17236) Suppress 'watch user page link' for IP range blocks * Wrap message 'searchresulttext' (Special:Search) into a div with class "mw-searchresult" +* (bug 15283) Interwiki imports can now fetch included templates === Bug fixes in 1.15 === * (bug 16968) Special:Upload no longer throws useless warnings. diff --git a/includes/Import.php b/includes/Import.php index 56e7a7fb96..17560a7220 100644 --- a/includes/Import.php +++ b/includes/Import.php @@ -1116,7 +1116,7 @@ class ImportStreamSource { } } - public static function newFromInterwiki( $interwiki, $page, $history=false ) { + public static function newFromInterwiki( $interwiki, $page, $history = false, $templates = false ) { if( $page == '' ) { return new WikiErrorMsg( 'import-noarticle' ); } @@ -1124,7 +1124,9 @@ class ImportStreamSource { if( is_null( $link ) || $link->getInterwiki() == '' ) { return new WikiErrorMsg( 'importbadinterwiki' ); } else { - $params = $history ? 'history=1' : ''; + $params = array(); + if ( $history ) $params['history'] = 1; + if ( $templates ) $params['templates'] = 1; $url = $link->getFullUrl( $params ); # For interwikis, use POST to avoid redirects. return ImportStreamSource::newFromURL( $url, "POST" ); diff --git a/includes/specials/SpecialImport.php b/includes/specials/SpecialImport.php index 5e1a653329..b6318c66a9 100644 --- a/includes/specials/SpecialImport.php +++ b/includes/specials/SpecialImport.php @@ -30,6 +30,7 @@ class SpecialImport extends SpecialPage { private $frompage = ''; private $logcomment= false; private $history = true; + private $includeTemplates = false; /** * Constructor @@ -88,10 +89,12 @@ class SpecialImport extends SpecialPage { } else { $this->history = $wgRequest->getCheck( 'interwikiHistory' ); $this->frompage = $wgRequest->getText( "frompage" ); + $this->includeTemplates = $wgRequest->getCheck( 'interwikiTemplates' ); $source = ImportStreamSource::newFromInterwiki( $this->interwiki, $this->frompage, - $this->history ); + $this->history, + $this->includeTemplates ); } } else { $source = new WikiErrorMsg( "importunknownsource" ); @@ -212,6 +215,12 @@ class SpecialImport extends SpecialPage { Xml::checkLabel( wfMsg( 'import-interwiki-history' ), 'interwikiHistory', 'interwikiHistory', $this->history ) . " + + + + " . + Xml::checkLabel( wfMsg( 'import-interwiki-templates' ), 'interwikiTemplates', 'interwikiTemplates', $this->includeTemplates ) . + " " . Xml::label( wfMsg( 'import-interwiki-namespace' ), 'namespace' ) . diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 5e09fdd26b..7df89805e0 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -2820,6 +2820,7 @@ Revision dates and editors' names will be preserved. All transwiki import actions are logged at the [[Special:Log/import|import log]].", 'import-interwiki-source' => 'Source wiki/page:', 'import-interwiki-history' => 'Copy all history versions for this page', +'import-interwiki-templates' => 'Include all templates', 'import-interwiki-submit' => 'Import', 'import-interwiki-namespace' => 'Destination namespace:', 'import-upload-filename' => 'Filename:', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index 31b46848f6..a3a41eb534 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -1975,6 +1975,7 @@ $wgMessageStructure = array( 'import-interwiki-text', 'import-interwiki-source', 'import-interwiki-history', + 'import-interwiki-templates', 'import-interwiki-submit', 'import-interwiki-namespace', 'import-upload-filename', -- 2.20.1